﻿#出版産業の夜明け
pbi_je_objective_the_dawn_of_the_publishing_industry = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/objectives/pbi_publishing_industry.dds"

	is_progressing = {
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = yes
		}
	}

	complete = {
		has_technology_researched = mass_communication
		any_scope_state = {
			literacy_rate >= pbi_publishing_industry_literacy_rate
			has_building = building_urban_center
		}
		any_scope_state = {
			has_building = building_pbi_publishing_industry
		}
	}
	on_complete = {
		hidden_effect = {
			start_tutorial_lesson = {
				tutorial_lesson = pbi_sg_the_dawn_of_the_publishing_industry_complete
			}
		}
	}


	weight = 500
	inheritable = yes
}
#大衆の時代
pbi_je_objective_the_era_of_the_masses = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/event_icons/event_newspaper.dds"

	is_progressing = {
	}

	complete = {
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			OR = {
				has_active_production_method = pbi_pm_rotary_presses
				has_active_production_method = pbi_pm_linotype
			}
			level >= 5
			occupancy >= 0.9
			is_subsidized = no
		}
		market_capital.market = {
			mg:pbi_goods_penny_press = {
				market_goods_pricier < 0.2
				market_goods_sell_orders > 1000
			}
		}
	}
	on_complete = {
	}

	invalid = {
	}
	on_invalid = {
	}

	weight = 500
	inheritable = yes
}
#電報事件
pbi_je_objective_telegram_incident = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/invention_icons/electrical_telegraph.dds"

	is_progressing = {
		has_variable = pbi_flag_selected_incident_target
		has_technology_researched = nationalism
		has_technology_researched = electric_telegraph
		any_rival_country = {
			has_technology_researched = nationalism
			has_diplomatic_pact = {
				who = ROOT
				type = rivalry
			}
		}
	}

	immediate = {
		set_variable = {
			name = pbi_var_je_objective_telegram_incident
			value = 0
		}
	}

	current_value = {
		value = var:pbi_var_je_objective_telegram_incident
	}
	
	goal_add_value = {
		add = 10
	}

	complete = {
		custom_tooltip = {
			text = pbi_je_objective_telegram_incident_flag_selected_incident_target
			has_variable = pbi_flag_selected_incident_target
		}
		has_technology_researched = nationalism
		has_technology_researched = electric_telegraph
		trigger_if = {
			limit = {
				has_variable = pbi_flag_selected_incident_target
			}
			var:pbi_flag_selected_incident_target = {
				has_technology_researched = nationalism
				has_diplomatic_pact = {
					who = ROOT
					type = rivalry
				}
			}
		}
		scope:journal_entry = {
			is_goal_complete = yes
		}
	}
	on_complete = {
		if = {
			limit = {
				NOT = {
					has_variable = pbi_flag_concessions_to_incident_target
				}
			}
			trigger_event = {
				id = pbi_objective_publishing_industry_events.400
				popup = yes
			}
		}
	}

	on_monthly_pulse = {
		effect = {
			if = {
				limit = {
					has_variable = pbi_var_je_objective_telegram_incident
					var:pbi_var_je_objective_telegram_incident < 1
				}
				set_variable = {
					name = pbi_var_je_objective_telegram_incident
					value = 0
				}
			}
			if = {
				limit = {
					has_variable = pbi_flag_selected_incident_target
					has_technology_researched = nationalism
					has_technology_researched = electric_telegraph
					var:pbi_flag_selected_incident_target = {
						has_technology_researched = nationalism
						has_diplomatic_pact = {
							who = ROOT
							type = rivalry
						}
					}
				}
				change_variable = {
					name = pbi_var_je_objective_telegram_incident
					add = 1
				}
			}
			else_if = {
				limit = {
					has_technology_researched = nationalism
					has_technology_researched = electric_telegraph
					any_rival_country = {
						has_technology_researched = nationalism
						has_diplomatic_pact = {
							who = ROOT
							type = rivalry
						}
					}
					NOT = {
						has_variable = pbi_flag_objective_publishing_industry_events_402_on_going
					}
				}
				trigger_event = {
					id = pbi_objective_publishing_industry_events.402
					popup = yes
				}
			}
		}
		events = {
			pbi_objective_publishing_industry_events.403 #関心地域でのトラブル
			pbi_objective_publishing_industry_events.404 #対象国からの高圧的な要求
			pbi_objective_publishing_industry_events.405 #会談の打ち切り
		}
	}

	progressbar = yes
	invalid = {
		hidden_trigger = {
			var:pbi_var_je_objective_telegram_incident > 0
			has_variable = pbi_flag_selected_incident_target
		}
		trigger_if = {
			limit = {
				has_variable = pbi_flag_selected_incident_target
			}
			NAND = {
				custom_tooltip = {
					text = pbi_je_objective_telegram_incident_flag_not_selected_incident_target
					exists = var:pbi_flag_selected_incident_target
				}
				var:pbi_flag_selected_incident_target = {
					has_technology_researched = nationalism
					has_diplomatic_pact = {
						who = ROOT
						type = rivalry
					}
				}
			}
		}
	}
	on_invalid = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.401
		}
		set_variable = {
			name = pbi_var_je_objective_telegram_incident
			value = 0
		}
	}

	weight = 500
	inheritable = yes
}
#産業と芸術
pbi_je_objective_industry_and_the_arts = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/goods_icons/pbi_goods_pop_art.dds"

	is_progressing = {
	}

	complete = {
		has_technology_researched = pbi_technology_arts_and_crafts
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			has_active_production_method = pbi_pm_commercial_poster
		}
		market_capital.market = {
			mg:pbi_goods_pop_art = {
				OR = {
					market_goods_consumption > 500
					market_goods_exports > 1000
				}
			}
		}
		scope:journal_entry = { is_goal_complete = yes }
	}
	on_complete = {
	}

	current_value = {
		value = gdp
	}
	goal_add_value = {
		value = gdp
		multiply = 0.25
	}

	invalid = {
	}
	on_invalid = {
	}

	weight = 500
	inheritable = yes
}
#写真の力
pbi_je_objective_the_power_of_photography = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/invention_icons/camera.dds"

	is_progressing = {
	}

	complete = {
		has_technology_researched = camera
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			has_active_production_method = pbi_pm_with_photo
			cash_reserves_ratio > 0.25
			occupancy >= 0.75
			level >= 5
			is_under_construction = no
			count >= 3
		}
	}
	on_complete = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.500
			popup = yes
		}
	}

	invalid = {
	}
	on_invalid = {
	}

	weight = 500
	inheritable = yes
}
#海を超えて
pbi_je_objective_across_the_sea = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/invention_icons/screw_frigate.dds"

	is_progressing = {
		has_technology_researched = electric_telegraph
		has_technology_researched = screw_frigate
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			has_active_production_method = pbi_pm_electric_telegraph
			cash_reserves_ratio > 0.5
			occupancy >= 0.75
			level >= 10
		}
		trigger_if = {
			limit = {
				OR = {
					country_is_in_east_asia = yes
					country_is_in_central_asia = yes
				}
			}
			has_interest_marker_in_region = region_pacific_coast
		}
		trigger_else_if = {
			limit = {
				OR = {
					country_is_in_europe = yes
					country_is_in_middle_east = yes
					country_is_in_africa = yes
				}
			}
			has_interest_marker_in_region = region_dixie
		}
		trigger_else = {
			has_interest_marker_in_region = region_england
		}
		any_scope_character = {
			has_role = admiral
			count >= 1
		}
	}

	immediate = {
		set_variable = {
			name = pbi_var_je_objective_across_the_sea
			value = 0
		}
	}

	current_value = {
		value = var:pbi_var_je_objective_across_the_sea
	}
	
	goal_add_value = {
		add = 20
	}

	complete = {
		has_technology_researched = electric_telegraph
		has_technology_researched = screw_frigate
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			has_active_production_method = pbi_pm_electric_telegraph
			cash_reserves_ratio > 0.5
			occupancy >= 0.75
			level >= 10
		}
		trigger_if = {
			limit = {
				OR = {
					country_is_in_east_asia = yes
					country_is_in_central_asia = yes
				}
			}
			has_interest_marker_in_region = region_pacific_coast
		}
		trigger_else_if = {
			limit = {
				OR = {
					country_is_in_europe = yes
					country_is_in_middle_east = yes
					country_is_in_africa = yes
				}
			}
			has_interest_marker_in_region = region_dixie
		}
		trigger_else = {
			has_interest_marker_in_region = region_england
		}
		custom_tooltip = {
			text = pbi_je_objective_across_the_sea_flag_character_in_laying
			any_scope_character = {
				has_variable = pbi_flag_character_in_laying
			}
			}
		scope:journal_entry = {
			is_goal_complete = yes
		}
	}
	on_complete = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.100
			popup = yes
		}
	}

	on_monthly_pulse = {
		effect = {
			if = {
				limit = {
					has_variable = pbi_var_je_objective_across_the_sea
					var:pbi_var_je_objective_across_the_sea < 1
				}
				set_variable = {
					name = pbi_var_je_objective_across_the_sea
					value = 0
				}
			}
			if = {
				limit = {
					has_technology_researched = electric_telegraph
					has_technology_researched = screw_frigate
					any_scope_building = {
						is_building_type = building_pbi_publishing_industry
						is_under_construction = no
						has_active_production_method = pbi_pm_electric_telegraph
						cash_reserves_ratio > 0.5
						occupancy >= 0.75
						level >= 10
					}
					trigger_if = {
						limit = {
							OR = {
								country_is_in_east_asia = yes
								country_is_in_central_asia = yes
							}
						}
						has_interest_marker_in_region = region_pacific_coast
					}
					trigger_else_if = {
						limit = {
							OR = {
								country_is_in_europe = yes
								country_is_in_middle_east = yes
								country_is_in_africa = yes
							}
						}
						has_interest_marker_in_region = region_dixie
					}
					trigger_else = {
						has_interest_marker_in_region = region_england
					}
					any_scope_character = {
						has_variable = pbi_flag_character_in_laying
					}
				}
				change_variable = {
					name = pbi_var_je_objective_across_the_sea
					add = 1
				}
			}
			else_if = {
				limit = {
					has_technology_researched = electric_telegraph
					has_technology_researched = screw_frigate
					any_scope_building = {
						is_building_type = building_pbi_publishing_industry
						is_under_construction = no
						has_active_production_method = pbi_pm_electric_telegraph
						cash_reserves_ratio > 0.5
						occupancy >= 0.75
						level >= 10
					}
					trigger_if = {
						limit = {
							OR = {
								country_is_in_east_asia = yes
								country_is_in_central_asia = yes
							}
						}
						has_interest_marker_in_region = region_pacific_coast
					}
					trigger_else_if = {
						limit = {
							OR = {
								country_is_in_europe = yes
								country_is_in_middle_east = yes
								country_is_in_africa = yes
							}
						}
						has_interest_marker_in_region = region_dixie
					}
					trigger_else = {
						has_interest_marker_in_region = region_england
					}
					NOT = {
						has_variable = pbi_flag_objective_publishing_industry_events_102_on_going
					}
					any_scope_character = {
						has_role = admiral
					}
				}
				trigger_event = {
					id = pbi_objective_publishing_industry_events.102 #提督を選ぶ
					popup = yes
				}
			}
		}
		events = {
			pbi_objective_publishing_industry_events.103 #資金集め　開始
			pbi_objective_publishing_industry_events.107 #敷設　開始
			pbi_objective_publishing_industry_events.111 #敷設　完了
		}
		random_events = {
			10 = 0
			5 = pbi_objective_publishing_industry_events.113 #資金集め　順調
			5 = pbi_objective_publishing_industry_events.104 #資金集め　難航
			1 = pbi_objective_publishing_industry_events.105 #資金集め　団体の支援
			1 = pbi_objective_publishing_industry_events.106 #資金集め　政府の支援
			2 = pbi_objective_publishing_industry_events.108 #敷設　切断
			3 = pbi_objective_publishing_industry_events.109 #敷設　嵐で中断
			1 = pbi_objective_publishing_industry_events.110 #敷設　巨大生物により切断
			5 = pbi_objective_publishing_industry_events.112 #テスト　通信失敗
		}
	}

	progressbar = yes

	invalid = {
		custom_tooltip = {
			text = pbi_je_objective_across_the_sea_flag_not_character_in_laying
			var:pbi_var_je_objective_across_the_sea > 0
			NOT = {
				any_scope_character = {
					has_variable = pbi_flag_character_in_laying
				}
			}
		}
	}
	on_invalid = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.101
		}
		set_variable = {
			name = pbi_var_je_objective_across_the_sea
			value = 0
		}
	}

	weight = 500
	inheritable = yes
}
#ベストセラー
pbi_je_objective_bestseller = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/event_icons/tutorial_icon.dds"

	is_progressing = {
		has_technology_researched = realism
		any_scope_character = {
			has_variable = pbi_flag_character_in_writing
		}
	}

	immediate = {
		set_variable = {
			name = pbi_var_je_objective_bestseller
			value = 0
		}
	}

	current_value = {
		value = var:pbi_var_je_objective_bestseller
	}
	
	goal_add_value = {
		add = 12 #1 year
	}

	complete = {
		has_technology_researched = realism
		custom_tooltip = {
			text = pbi_je_objective_bestseller_flag_character_in_writing
			any_scope_character = {
				has_variable = pbi_flag_character_in_writing
			}
		}
		scope:journal_entry = {
			is_goal_complete = yes
		}
	}
	on_complete = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.200
			popup = yes
		}
	}

	on_monthly_pulse = {
		random_events = {
			10 = 0
			1 = pbi_objective_publishing_industry_events.203 #筆が進まない
			1 = pbi_objective_publishing_industry_events.204 #作家が校閲を認めない
			1 = pbi_objective_publishing_industry_events.205 #内容への批判
			1 = pbi_objective_publishing_industry_events.206 #剽窃疑惑
			1 = pbi_objective_publishing_industry_events.207 #予言的事件で作品が注目される
			1 = pbi_objective_publishing_industry_events.208 #著名人の好意的感想
			1 = pbi_objective_publishing_industry_events.209 #著名人の批判的感想
			1 = pbi_objective_publishing_industry_events.210 #徐々に人気が出る
			1 = pbi_objective_publishing_industry_events.211 #特定地域のポップに人気
			1 = pbi_objective_publishing_industry_events.212 #出版停止
		}
		effect = {
			if = {
				limit = {
					has_variable = pbi_var_je_objective_bestseller
					var:pbi_var_je_objective_bestseller < 1
				}
				set_variable = {
					name = pbi_var_je_objective_bestseller
					value = 0
				}
			}
			if = {
				limit = {
					has_technology_researched = realism
					any_scope_character = {
						has_variable = pbi_flag_character_in_writing
					}
				}
				change_variable = {
					name = pbi_var_je_objective_bestseller
					add = 1
				}
			}
			else_if = {
				limit = {
					has_technology_researched = realism
					NOT = {
						has_variable = pbi_flag_objective_publishing_industry_events_202_on_going
					}
				}
				trigger_event = {
					id = pbi_objective_publishing_industry_events.202 #作家を選ぶ
					popup = yes
				}
			}
		}
	}

	progressbar = yes

	invalid = {
		custom_tooltip = {
			text = pbi_je_objective_bestseller_flag_not_character_in_writing
			var:pbi_var_je_objective_bestseller > 0
			NOT = {
				any_scope_character = {
					has_variable = pbi_flag_character_in_writing
				}
			}
		}
	}
	on_invalid = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.201
		}
		set_variable = {
			name = pbi_var_je_objective_bestseller
			value = 0
		}
	}

	weight = 500
	inheritable = yes
}
#ペンは剣よりも強し
pbi_je_objective_the_pen_is_mightier_than_the_sword = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/pops_icons/bureaucrats.dds"

	is_progressing = {
	}

	complete = {
		has_technology_researched = political_agitation
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			has_active_production_method = pbi_pm_propaganda_poster
		}
		any_scope_pop = {
			is_pop_type = pbi_journalists
			standard_of_living < 15
			pop_employment_building = building_pbi_publishing_industry
			count < 1
		}
		OR = {
			has_law = law_type:law_parliamentary_republic
			has_law = law_type:law_presidential_republic
		}
		has_law = law_type:law_protected_speech
		has_law = law_type:law_guaranteed_liberties
		has_law = law_type:law_universal_suffrage
	}
	on_complete = {
	}

	invalid = {
	}
	on_invalid = {
	}

	weight = 500
	inheritable = yes
}
#戦場より
pbi_je_objective_from_the_battlefield = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/invention_icons/mandatory_service.dds"

	is_progressing = {
		has_technology_researched = war_propaganda
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			has_active_production_method = pbi_pm_military_reporter
			cash_reserves_ratio > 0.25
			occupancy >= 0.9
			level >= 10
		}
		any_scope_war = {
			any_scope_front = {
				any_scope_state = {
					NOT = { owner = ROOT }
				}
				any_scope_general = {
					owner = ROOT
				}
			}
		}
	}

	immediate = {
		set_variable = {
			name = pbi_var_je_objective_from_the_battlefield
			value = 0
		}
	}

	current_value = {
		value = var:pbi_var_je_objective_from_the_battlefield
	}
	
	goal_add_value = {
		add = 12 #3 months
	}

	complete = {
		has_technology_researched = war_propaganda
		any_scope_building = {
			is_building_type = building_pbi_publishing_industry
			is_under_construction = no
			has_active_production_method = pbi_pm_military_reporter
			cash_reserves_ratio > 0.25
			occupancy >= 0.9
			level >= 10
		}
		any_scope_war = {
			any_scope_front = {
				any_scope_state = {
					NOT = { owner = ROOT }
				}
				any_scope_general = {
					owner = ROOT
				}
			}
		}
		scope:journal_entry = {
			is_goal_complete = yes
		}
	}

	on_complete = {
		trigger_event = {
			id = pbi_objective_publishing_industry_events.300
			popup = yes
		}
	}

	on_weekly_pulse = {
		effect = {
			if = {
				limit = {
					has_variable = pbi_var_je_objective_from_the_battlefield
					var:pbi_var_je_objective_from_the_battlefield < 1
				}
				set_variable = {
					name = pbi_var_je_objective_from_the_battlefield
					value = 0
				}
			}
			if = {
				limit = {
					has_technology_researched = war_propaganda
					any_scope_building = {
						is_building_type = building_pbi_publishing_industry
						is_under_construction = no
						has_active_production_method = pbi_pm_military_reporter
						cash_reserves_ratio > 0.25
						occupancy >= 0.9
						level >= 10
					}
					any_scope_war = {
						any_scope_front = {
							any_scope_state = {
								NOT = { owner = ROOT }
							}
							any_scope_general = {
								owner = ROOT
							}
						}
					}
				}
				change_variable = {
					name = pbi_var_je_objective_from_the_battlefield
					add = 1
				}
			}
		}
	}

	progressbar = yes

	invalid = {
		var:pbi_var_je_objective_from_the_battlefield > 0
		NOT = {
			any_diplomatic_play = {
				is_war = yes
			}
		}
	}
	on_invalid = {
		set_variable = {
			name = pbi_var_je_objective_from_the_battlefield
			value = 0
		}
	}

	weight = 500
	inheritable = yes
}
#メディアの王
pbi_je_objective_king_of_media = {
	should_be_pinned_by_default = yes
	icon = "gfx/interface/icons/objectives/pbi_publishing_industry.dds"

	is_progressing = {
	}

	complete = {
		game_date > 1935.12.30
		has_technology_researched = film
		leading_producer_of = g:pbi_goods_penny_press
		leading_producer_of = g:pbi_goods_pop_art
		market_capital.market = {
			participants >= 3
			mg:pbi_goods_penny_press = {
				market_goods_exports > 5000
			}
			mg:pbi_goods_pop_art = {
				market_goods_exports > 1000
			}
		}
	}
	on_complete = {
		hidden_effect = {
			owner = {
				start_tutorial_lesson = { 
					tutorial_lesson = pbi_sg_king_of_media_complete
					journal_entry = je:pbi_je_objective_king_of_media
				}
			}
		}
	}

	invalid = {
	}
	on_invalid = {
	}

	weight = 500
	inheritable = yes
}
